import { inject, provide, InjectionKey, App } from 'vue';
import { ref, Ref } from 'vue';


export interface SimpleState{
    sidebarIsCollapse:Ref<boolean>
}

// 简单的状态共享,感觉非常简单不通过 mutations 更改的,可以写这里
export const simpleState:InjectionKey<SimpleState>=Symbol()


// export function createInjectableState(){
//     return {
//         install(app:App){
            
//         }
//     }
// }


export const initSimpleState = () => {
    provide(simpleState,{
        sidebarIsCollapse:ref(false)
    })
}

export const getState = stateSymbol =>{
    return inject(stateSymbol)
}
